﻿using System;
using System.Runtime.Serialization;

namespace JTLeigh.Commerce.Spencer.Core.Common.Exceptions
{

	/// <summary>
	/// Exception thrown when an assertion fails.
	/// </summary>
	[Serializable]
	public sealed class AssertionFailedException : Exception
	{

		#region Fields

		internal const string DefaultMessage = "Assertion failed.";

		#endregion // Fields

		#region Constructors

		/// <summary>
		/// Initializes a new instance of the <see cref="AssertionFailedException"/> class.
		/// </summary>
		public AssertionFailedException()
			: base(DefaultMessage)
		{
		}

		/// <summary>
		/// Initializes a new instance of the <see cref="AssertionFailedException"/> class with
		/// the specified message.
		/// </summary>
		/// <param name="message">The message that describes the failed assertion.</param>
		public AssertionFailedException(string message)
			: base(message)
		{
		}

		/// <summary>
		/// Initializes a new instance of the <see cref="AssertionFailedException"/> class with
		/// the specified message and inner exception.
		/// </summary>
		/// <param name="message">The message that describes the failed assertion.</param>
		/// <param name="innerException">The <see cref="Exception"/> that is the root cause of 
		/// the exception being thrown.</param>
		public AssertionFailedException(string message, Exception innerException)
			: base(message, innerException)
		{
		}

		/// <summary>
		/// Initializes a new instance of the <see cref="AssertionFailedException"/> class as a
		/// result of serialization.
		/// </summary>
		/// <param name="info">The <see cref="SerializationInfo"/> object that holds
		/// serialized object information about the exception being thrown.</param>
		/// <param name="context">The <see cref="StreamingContext"/> object that contains 
		/// contextual information about the source and the destination.</param>
		private AssertionFailedException(SerializationInfo info, StreamingContext context)
			: base(info, context)
		{
		}

		#endregion // Constructors

	}

}
